<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>04_JS流程控制</title>
</head>
<body>
  <script>
    //1.顺序结构
    console.log('1');
    console.log('2');
    console.log('3');

    //2.分支结构
    let name='tom';
    if(!name){
      alert('请先登录！');
    }else {
      alert('欢迎'+name+'回归！')
    }

    //选择分支
    let gender=0;
    switch (gender){
      case 0:
        console.log('女');
        break;
      case 1:
        console.log('男');
        break;
      default:
        console.log('未知');
        break;
    }

    //循环结构
    let names=['迪丽热巴','金靖','白宇'];
    for(let i=0;i<names.length;i++){
      console.log(names[i]);
    }
    // console.log(i);
    //增强for循环
    for(let n of names){
      console.log(n);
    }
  </script>

</body>
</html>